<?php
class MySQL {
	public $con;
	
	public function __construct($host, $user, $password, $database) {
		$this -> con = new mysqli($host, $user, $password, $database)
			or die ('Could not connect to the database server' . mysqli_connect_error());
		
		if (is_resource($this -> con)) {
			mysqli_select_db($database) or die(mysql_error());
		}
	}

	public function __destruct() {
		if (is_resource($this -> con)) {
			mysql_close($this -> con);
		}
	}
}
?>